﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="StepFinish.ascx.cs"
    Inherits="ShopOnline.Controls.BusinessCard.StepFinish" %>
<script type="text/javascript">

    function GetDataCard() {
        var Card = new Object();
        //Set card border
        Card.BorderType = $(".rBorderType").val();
        //Set Front Card
        var FrontCard = new Object();

        FrontCard.Background = getFileName($("#front-card").css("background-image"));
        if ($("#body-front-card").find("img.card-logo").size() > 0) {
            FrontCard.Logo = $("#body-front-card img.card-logo").attr("src");
            FrontCard.LogoPositionX = parseInt($("#body-front-card img.card-logo").css("left"));
            FrontCard.LogoPositionY = parseInt($("#body-front-card img.card-logo").css("top"));
        }
        else {
            FrontCard.Logo = "";
        }
        if ($("#body-front-card").find(".text-block").size() > 0) {
            var ListTextBlock = new Array();
            $("#body-front-card").find(".text-block").each(function (i) {
                ListTextBlock[i] = new Object();
                ListTextBlock[i].PositionLeft = parseInt($(this).css("left"));
                ListTextBlock[i].PositionTop = parseInt($(this).css("top"));
                ListTextBlock[i].Text = $(this).find("div.text").html();
            });
            FrontCard.ListTextBlock = ListTextBlock;
        }

        //Set Back Card
        var BackCard = new Object();
        BackCard.Background = getFileName($("#back-card").css("background-image"));
        if ($("#body-back-card").find("img.card-logo").size() > 0) {
            BackCard.Logo = $("#body-back-card img.card-logo").attr("src");
            BackCard.LogoPositionX = parseInt($("#body-back-card img.card-logo").css("left"));
            BackCard.LogoPositionY = parseInt($("#body-back-card img.card-logo").css("top"));
        }
        else {
            BackCard.Logo = "";
        }
        if ($("#body-back-card").find(".text-block").size() > 0) {
            var ListTextBlock = new Array();
            $("#body-back-card").find(".text-block").each(function (i) {
                ListTextBlock[i] = new Object();
                ListTextBlock[i].PositionLeft = parseInt($(this).css("left"));
                ListTextBlock[i].PositionTop = parseInt($(this).css("top"));
                ListTextBlock[i].Text = $(this).find("div.text").html();
            });
            BackCard.ListTextBlock = ListTextBlock;
        }
        Card.FrontCard = FrontCard;
        Card.BackCard = BackCard;
        //get card contact
        var CardContact = new Object();
        CardContact.Name = $("#<%= txtContactName.ClientID %>").val();
        CardContact.Address = $("#<%= txtContactAddress.ClientID %>").val();
        CardContact.Phone = $("#<%= txtContactPhone.ClientID %>").val();
        CardContact.Email = $("#<%= txtContactEmail.ClientID %>").val();
        Card.CardContact = CardContact;
        return Card;
    }

    //Save as draft
    function saveDraft() {
        if (confirm("Do you want to save this desgin as draft?") == true) {
            var Card = GetDataCard();
            var jsonCard = JSON.stringify(Card);
            PageMethods.SaveAsDraft(jsonCard, successSave);
        }
    }

    //Save as template
    function saveTemplate() {
        if (confirm("Do you want to save this desgin as a card template?") == true) {
            var Card = GetDataCard();
            var jsonCard = JSON.stringify(Card);
            PageMethods.SaveAsTemplate(jsonCard, successSave);
        }
    }

    //Save as template
    function saveSubmit() {
        if (confirm("Do you want to submit this desgin tu us?") == true) {
            var Card = GetDataCard();
            var jsonCard = JSON.stringify(Card);
            PageMethods.SaveAndSubmit(jsonCard, successSave);
        }
    }

    function successSave() {
        showNotification('All For You Online', 'Your design has been saved. Thank you for supporting us!');
    }
</script>
<div class="content-divider-step1">
    <div class="col-left">
        <div class="block block-poll">
            <div class="sidebar-block">
                <div class="corners-top">
                    <div>
                        <div>
                            &nbsp;</div>
                    </div>
                </div>
                <div class="border-left">
                    <div class="border-right">
                        <div class="block-title">
                            <strong><span>In Stock</span></strong>
                            <div class="block-content">
                                <input type="text" value="Name Your Business Card" class="card-name" style="width:200px" />
                                <span>Quantity:</span>
                                <input id="productAttributes_quantity-input" class="selectionUiComboBox-input" type="text" style="width:50px"
                                    value="1" name="qty">
                                <div id="productAttributes_quantity_selector" class="selectorValueDisplay selectorValueDisplay-Horizontal selectorValueDisplayDroplistButton"
                                    style="display: block; cursor: pointer;">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="corners-bot">
                    <div>
                        <div>
                            &nbsp;</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-right-step1" align="center">
        <div style="height: 30px">
        </div>
        <div class="bc-form" align="center">
            <table cellpadding="5" cellspacing="5" align="center">
                <tr>
                    <td colspan="10">
                        <h2>
                            Contact Information</h2>
                        <p class='subtitle'>
                            Provide the information or help us to serve you better by logging into the website.
                            If you are new to us, you can register <a id="A1" runat="server" href="~/Register.aspx">
                                here</a>.</p>
                    </td>
                </tr>
                <tr>
                    <td>
                        Name
                        <label class='required'>
                            *</label>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txtContactName" CssClass="tb7" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Address
                        <label class='required'>
                            *</label>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txtContactAddress" CssClass="tb7" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Phone (Tel)
                        <label class='required'>
                            *</label>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txtContactPhone" CssClass="tb7" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Email
                        <label class='required'>
                            *</label>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txtContactEmail" CssClass="tb7" />
                    </td>
                </tr>
            </table>
        </div>
        <div style="height: 20px">
        </div>
        <div align="center">
            <button visible="false" runat="server" onclick="saveDraft(); return false;" id="buttonSaveAsTemplate"
                title="Save as Template" class="button">
                <span><span>Save as Template</span></span></button>
            <button visible="false" runat="server" onclick="saveTemplate(); return false;" id="buttonSaveAsDraft"
                title="Save as Draft" class="button">
                <span><span>Save as Draft</span></span></button>
            <button runat="server" onclick="saveSubmit(); return false;" id="buttonSubmit" title="Save & Submit"
                class="button">
                <span><span>Save & Submit</span></span></button>
        </div>
    </div>
